<script setup lang="ts">
// #ifdef MP
import { onAddToFavorites, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app'
import { wxCollect, wxShare } from '@/libs/share'

onShareAppMessage(wxShare(true))
onShareTimeline(wxShare(false))
onAddToFavorites(wxCollect())
// #endif

import { list, updateVIPContent } from './data'
import { imagePath } from '@/libs/file-utils'

const img_logo = imagePath('user/vip-content/logo.png')
const img_card = imagePath('user/vip-content/card.png')
const img_level = imagePath('user/vip-content/level-bg.png')

const toInfo = () => uni.navigateTo({ url: '/pages/user/vip-content/info' })

updateVIPContent()
</script>

<template>
  <PageWrapper
    name="user-vip-content"
    :pageStyle="{ backgroundColor: '#FFC1B0' }"
  >
    <div class="title">蒜芽萌新权益</div>

    <div class="box">
      <div
        class="logo"
        :style="{ backgroundImage: img_logo }"
      ></div>
      <div
        v-for="(item, index) in list"
        :key="index"
        class="item"
        :style="{ backgroundImage: img_card }"
      >
        <div
          class="level"
          :style="{ backgroundImage: img_level }"
        >等级{{ item.level }}：</div>
        <div class="text1">{{ item.name }}</div>
        <div class="text2">{{ item.description }}</div>
      </div>
    </div>

    <div
      class="more"
      @click="toInfo"
    >了解更多</div>
  </PageWrapper>
</template>

<style lang="less" scoped>
.title {
  margin-top: 70rpx;

  color: #952E36;
  text-align: center;
  font-size: 72rpx;
  line-height: 104rpx;
  text-shadow: 0 0 4rpx #fff, 0 0 4rpx #fff, 0 0 4rpx #fff;
}

.box {
  position: relative;
  width: 686rpx;

  margin: 40rpx auto;

  box-sizing: border-box;
  padding: 52rpx 70rpx 52rpx 64rpx;

  border-radius: 64rpx;

  background-color: #FFC347;
  box-shadow: 0 0 10rpx 6rpx #FF6B35, 0 8rpx 8rpx 0 rgba(#fff, .45) inset;

  display: flex;
  flex-direction: column;
  row-gap: 20rpx;

  .logo {
    position: absolute;
    top: -90rpx;
    right: -28rpx;

    width: 178rpx;
    height: 166rpx;

    z-index: 1;
  }

  .item {
    position: relative;
    width: 552rpx;
    height: 266rpx;

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    .level {
      position: absolute;
      top: -4rpx;
      left: -4rpx;

      width: 147rpx;
      height: 75rpx;

      color: #952E36;
      font-size: 32rpx;
      line-height: 70rpx;
      text-align: center;
      text-shadow: 0 0 4rpx #fff, 0 0 4rpx #fff, 0 0 4rpx #fff, 0 0 4rpx #AA6E00;
    }

    .text1 {
      color: #590000;
      font-size: 48rpx;
      line-height: 48rpx;
      text-shadow: 0 0 6rpx #fff, 0 0 6rpx #fff, 0 0 6rpx #fff;
    }

    .text2 {
      margin-top: 20rpx;

      color: rgba(#590000, .7);
      font-size: 40rpx;
      line-height: 40rpx;
      text-shadow: 0 0 4rpx #fff, 0 0 4rpx #fff, 0 0 4rpx #fff, 0 0 4rpx #fff;
    }
  }
}

.more {
  width: 506rpx;
  height: 108rpx;

  margin: 20rpx auto;

  border-radius: 54rpx;

  background-color: #FFBD32;
  box-shadow: 0 4rpx 10rpx 0 #FF6B35, 0 2rpx 4rpx 0 rgba(#fff, .57) inset, 0 0 8rpx 0 rgba(233, 196, 255, .5) inset;

  color: #952E36;
  font-size: 48rpx;
  line-height: 114rpx;
  text-align: center;
  text-shadow: 0 0 4rpx #fff, 0 0 4rpx #fff, 0 0 4rpx #fff;
}
</style>